package test3;



import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class JDBC_Finally {

    public static void main(String[] args)throws   Exception {

        Connection connection = DBUtils.getConnection();
        String sql="select * from t_student ";
        PreparedStatement ps = connection.prepareStatement(sql);
        ResultSet resultSet = ps.executeQuery();
        while (resultSet.next()){
            String id = resultSet.getString("id");
            String name = resultSet.getString("name");
            int age = resultSet.getInt("age");
            System.out.println(id);
            System.out.println(name);
            System.out.println(age);
        }
        DBUtils.close(connection,ps,resultSet);
    }
}
